package com.itc.bi.feign;

import com.itc.bi.api.dto.DataSetDto;
import com.itc.bi.api.vo.DataSetVO;
import com.itc.bi.service.FeignClientService;
import com.itc.bi.vo.excelVo.HeardVO;
import com.itc.common.core.domain.R;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Api(tags = "调度服务Feign远程调用客户端")
@RestController
@RequestMapping("/feignClient")
public class FeignClient {
    @Autowired
    FeignClientService feignClientService;

    @PostMapping(value = "/dataSet/query")
    @ApiOperation(value = "数据集查询数据")
    public R<DataSetVO> dataSet(@RequestBody DataSetDto dto){
        return R.ok(feignClientService.query(dto));
    }

    @PostMapping(value = "/dataSet/column")
    @ApiOperation(value = "数据集查询数据")
    public R<List<HeardVO>> column(@RequestBody DataSetDto dto){
        return R.ok(feignClientService.columnsByDataSetId(dto.getDataSetId()));
    }

}
